<%@ page contentType="text/html; charset=UTF-8" %>

<%@ taglib uri="/struts-tags" prefix="s" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" -->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ca" lang="ca_ES">


    <head>
        <title>
            <s:text name="exuoc.nom.pseudonim"/>
        </title>

        <%-- Dades de la capçalera de la pàgina --%>
        <jsp:include page="/WEB-INF/jspf/metas.jsp"  flush="true" />
    </head>
<body>&nbsp;

<script type="text/javascript">
<!--
    function addFila(){
        var taula = document.getElementById('taulaDC');
//        var root=taula.getElementsByTagName('tr')[0].parentNode;//the TBODY
        var tbody=taula.tBodies[0];
        var numFila=tbody.rows.length;
//      tbody.rows[1].id='fila'+numFila;
        var clone=taula.getElementsByTagName('tr')[1].cloneNode(true);
        clone.id='fila'+numFila;
        tbody.appendChild(clone);//appends the clone

    }
    function delFila(num){
       var taula= document.getElementById('taulaDC') ;
       var tbody = taula.tBodies[0];
        if (tbody.rows.length > 2 ){
                tbody.removeChild(tbody.lastChild);
        }

  //      root.removeChild(child);
    }
  


// -->
</script>

<div id="principal">
    <%-- Capçalera del dipòsit --%>
    <jsp:include page="/WEB-INF/jspf/capsalera.jsp" flush="true"/>
        <big><big><big>
            <s:if test="idItemActual>0">
                <s:text name="exuoc.item.modificar.titolpagina" />
            </s:if>
            <s:else>
                <s:text name="exuoc.item.afegir.titolpagina" />
            </s:else>
                </big></big></big>
        <br /><br />
        <big><i>
            <s:text name="exuoc.item.dc.dades" />
        </i></big><br />

        <s:if test="actionMessages.size()>0">
            <s:actionmessage />
        </s:if>
        <s:if test="errorMessages.size()>0">
            <font class="error" >
            <s:actionerror />
            </font>
        </s:if>
        <br/>
        <%-- COMENÇAMENT DEL CONTINGUT DE LA PÀGINA --%>
        <s:if test="#session.isGestor==true || #session.isAdmin==true">
        
           <s:form method="post"  namespace="/items" name="editarFormDC"
                action="editarArxiu_Items" theme="css_xhtml">

                <%-- <s:hidden name="model" />
                <s:hidden name="item" />
                <s:hidden name="idItemActual"/> --%>
                <s:hidden name="nom"/>
                <s:hidden name="autor"/>
                <s:hidden name="descripcio"/>
                <s:hidden name="privat"/>
                <s:hidden name="idContenidorActual"/>


               <table style="text-align: left; height: 38px; width: 700px;"
                    border="1" cellpadding="2" cellspacing="2" id="taulaDC">
                <tbody>
                    <tr class="FilaSenar">
                        <td><img alt="<s:text name="exuoc.item.dc.afegir"/>"
                                      src="/exuoc/gifs/add.png"
                                      height="16" width="16"
                                      onclick="addFila();"/>
                          <img alt="<s:text name="exuoc.item.dc.treure"/>"
                                      src="/exuoc/gifs/cancel.png"
                                      height="16" width="16"
                                      onclick="delFila();"/>
                        </td>
                        <th class="thAmplada thMinAmplada">
                            <s:text name="exuoc.item.dc.element"/></th>
                        <th><s:text name="exuoc.item.dc.valor"/></th>
                    </tr>
                    <tr class="FilaParell">
                        <td><br/></td>
                        <td>
                            <s:select name="dc" list="llistaDC"
                              listKey="id" listValue="nom" disabled="false"
                              labelposition="left" tabindex="1"/>
                        </td>
                            <td><s:textfield name="dcValor" maxLength="100"
                                      size="40" required="true" tabindex="2"
                                      onFocus="this.select()"/>
                            </td>
                    </tr>
                </tbody>
                </table>
                <br />
                <s:submit value="%{getText('exuoc.item.afegir.seguent')}"
                    labelposition="left"  cssClass="BotoEnviar"/>

                <s:reset value="%{getText('exuoc.item.afegir.reset')}"
                    labelposition="left" cssClass="BotoCancelar"/>
           </s:form>

        </s:if>
        <s:else>
            <br/><br/>
            <font class="error" >
                <s:text   name="exuoc.seguretat.permis.denegat"/>
                <s:if test="errorMessages.size()>0">
                    <s:actionerror />
                </s:if>
            </font>
        </s:else>
        <%-- Peu de la pàgina web --%>
        <jsp:include page="/WEB-INF/jspf/peu.jsp"  />

</div>
</body></html>